<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8" import="java.util.*"%>

<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@include file="../include/admin/adminHeader.jsp"%>
<%@include file="../include/admin/adminNavigator.jsp"%>

<title>编辑产品属性值</title>
<script type="text/javascript">
$(function(){
	$("input.pvValue").blur(function(){
		var pvValue = $(this).val();
		var pvid = $(this).attr("pvid");
		var parentSpan = $(this).parent("span");
		$.ajax({
			url: "admin_product_updatePropertyValue",
			type: "POST",
			data: {"id":pvid,"value":pvValue},
			success: function(result){
				if (result=="success") {
					parentSpan.css("border","1px solid green");
				} else {
					parentSpan.css("border","1px solid red");
				}
			}
		});
	});
});
</script>

<div class="workingArea">
	<ol class="breadcrumb">
		<li><a href="admin_category_list">所有分类</a></li>
		<li><a href="admin_product_list?cid=${p.category.id}">${p.category.name}</a></li>
		<li class="active">${p.name}</li>
		<li class="active">编辑产品属性</li>
	</ol>
	
	<div class="editPVDiv">
		<c:forEach items="${pvs}" var="pv">
			<div class="eachPV">
				<span class="pvName">${pv.property.name}</span>
				<span class="pvValue"><input type="text" pvid="${pv.id}" class="pvValue" value="${pv.value}" /></span>
			</div>
		</c:forEach>
		<div style="clear:both"></div>
	</div>
</div>
